package homework.day03;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test04 {
    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
        FileOutputStream fos = new FileOutputStream("pw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw, true);

        Scanner scanner = new Scanner(System.in);
        System.out.println("请开始输入内容");
        while (true) {
            String str = scanner.nextLine();
            if ("exit".equalsIgnoreCase(str)) {
                break;
            }
            pw.println(str);
        }
        pw.close();
    }
}